<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!-- header -->
<jsp:include page="../include/header.jsp"></jsp:include>
	<header id="header">

	<!--/header-middle-->
	<jsp:include page="../include/header_middle.jsp"></jsp:include>		
	
	<!--header-bottom-->
	<jsp:include page="../include/header_bottom.jsp"></jsp:include>	
	<!--/header-bottom-->
	
	</header>
	<!--/header-->
	
	<section>
		<div class="container">
			<div class="row">
				<div class="col-sm-2">
					
				</div>
				
				<div class="col-sm-9 padding-right">	
					<!--각자 삽입할 부분-->
					<form name="f" action="boardmodify" method="post">
					<table class="table table-bordered">
						<tr>
							<td width="10%" align="center">글번호</td>
							<td width="15%" align="center">${ board.board_no }</td>
							<td width="10%" align="center">제목</td>
							<td width="45%" colspan="3"><input name="board_title" type="text" value="${ board.board_title }"/></td>
							<td width="10%" align="center">조회수</td>
							<td width="10%" align="center">${ board.board_show }</td>
						</tr>

						<tr>
							<td align="center">등록일</td>
							<td align="center">${ board.board_date }</td>
							<td align="center">게시자</td>
							<td>${ board.board_nickname }(${ board.board_id })</td>
							<td>타입</td>
							<td>
								<select name="board_type">
									<c:forEach items="${ typeList }" var="type">
										<option value="${ type.btype_no }">${ type.btype_name }</option>	
									</c:forEach>
								</select>
							</td>
							<td align="center">추천수</td>
							<td align="center">${ board.board_recommend }</td>
						</tr>

						<tr>
							<td colspan="8" bgcolor="#fe980f"></td>
						</tr>

						<tr>
							<td colspan="8"><textarea id="content" name="board_content" class="form-control" rows="10">${ board.board_content }</textarea></td>
						</tr>
					</table>
					<input type="hidden" name="board_no" value="${ board.board_no }"/>
					<input type="hidden" name="board_type" value="${ board.board_type }"/>
					<input type="hidden" name="board_image" value="${ board.board_image }"/>
					
					<div class="row" align="center">
						<button type="submit" class="btn btn-primary btn-lg" onclick="replace()">수정</button>
					</div>
					</form>
					
					<br/>
					<br/>
					<br/>
					
					<!--삽입 끝 -->					
				</div>
			</div>
		</div>
	</section>
	
	<script type="text/javascript">
		function replace(){
			document.f.content.value = document.f.content.value.replace( /\n/gi, '<br//>');
		}
		
		function replace_br(){
			document.f.content.value = document.f.content.value.split("<br//>").join("\n");
		}
		
		window.onload=replace_br 
	</script>
	
	<!--Footer-->
	<jsp:include page="../include/footer.jsp"></jsp:include>
	<!--/Footer-->